package cn.tangshh.universal.core.enums;

import com.fasterxml.jackson.annotation.JsonValue;
import lombok.AllArgsConstructor;
import lombok.Getter;

@Getter
@AllArgsConstructor
public enum LimitType implements AbstractEnum {
    CUSTOMER(0, "默认"),
    IP(1, "IP"),
    USER(2, "用户"),
    PARAM(3, "参数"),
    USER_PARAM(4, "用户及参数"),
    ;
    @JsonValue
    private final int value;
    private final String describe;

    public static LimitType valueOf(int value) {
        for (LimitType type : LimitType.values()) {
            if (type.value == value)
                return type;
        }
        return CUSTOMER;
    }
}
